{{ partial "header.html" . }}

{{- if not .IsHome }}
<h1 class="title">{{ .Title | markdownify }}</h1>
<nav id="TableOfContents">
  <ul><li><a href="#contentos">内容</a></li></ul></nav>
{{ end -}}

<main>
{{ .Content }}
</main>

<hr/>
<h3 id="contentos">内容</h3>
{{- $pages := .Pages }}
{{ if or (.IsHome) (eq .Params.slug "omnes") }}
  {{- $pages = .Site.RegularPages -}}
  <p>本站文章总数: {{ len $pages }}.</p>
{{ end -}}
<ul>
  {{- if or (isset .Params "intermedie") (eq .Params.slug "omnes") -}}
    {{- range (where $pages "Section" "!=" "") }}
  <li>
      {{- if (gt .Params.date 0) -}}
      <span class="date">{{ .Date.Format "2006-01-02." }}</span>
      {{- end }}
      <a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
      {{- with .Params.summary }}
      <blockquote><p>{{ . | markdownify }}</p></blockquote>
      {{- end }}
  </li>
    {{- end -}}
  {{- else if .IsHome -}}
    {{- $paginator := .Paginate (where $pages "Section" "!=" "") 5 -}}
    {{- range $paginator.Pages -}}
      {{- if not (isset .Params "hidden") }}
  <li>
      {{- if (gt .Params.date 0) -}}
      <span class="date">{{ .Date.Format "2006-01-02." }}</span>
      {{- end }}
      <a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
      {{- with .Params.summary }}
      <blockquote><p>{{ . | markdownify }}</p></blockquote>
      {{- end }}
  </li>
      {{- end -}}
    {{- end -}}
  {{- else -}}
    {{- $paginator := .Paginate (where $pages "Section" "!=" "") -}}
    {{- range $paginator.Pages -}}
      {{- if not (isset .Params "hidden") }}
  <li>
      {{- if (gt .Params.date 0) -}}
      <span class="date">{{ .Date.Format "2006-01-02." }}</span>
      {{- end }}
      <a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
      {{- with .Params.summary }}
      <blockquote><p>{{ . | markdownify }}</p></blockquote>
      {{- end }}
  </li>
      {{- end -}}
    {{- end -}}
  {{- end }}
</ul>
{{ if not (or (isset .Params "intermedie") (eq .Params.slug "omnes")) -}}
  {{- template "_internal/pagination.html" . -}}
{{- end -}}

{{- partial "footer.html" . }}
